/**
 * Author(s): xuming.Wong <xuming.Wong@gmail.com>
 */

#ifndef __M2_ANIM_DATA_H__
#define __M2_ANIM_DATA_H__

#include "M2Model.h"

namespace GNgine
{
	/*M2 model contain this
	*/
	class M2AnimData
	{
	public:
		M2AnimData(M2Model* m2Model,M2AnimBlock animblock);

		//has animated data
		inline bool hasAnimData(int index)
		{
			if (_seqIndex>=0){
				index = 0;
			}
			return (_nData[index]>0);
		}


		Ogre::Vector3 getVector3(Ogre::uint anim, Ogre::uint time);
		Ogre::Vector4 getUnpackVector4(Ogre::uint anim, Ogre::uint time);
	private:
		void init(M2AnimBlock animblock);
	private:
		M2Model* _m2Model;//the owner
		M2File* _m2File;
		M2AnimFileList _animFileList;

		unsigned int *_globalSeqs;
		short _seqIndex;//seqence id in global
		short _interpType;//interpolate type


		Ogre::uint *_times[MAX_ANIMATED];//each slot is a time line
		Ogre::uint _nTimes[MAX_ANIMATED];//each slot is a time line length?
		void* _data[MAX_ANIMATED];//anim _data
		Ogre::uint _nData[MAX_ANIMATED];//eg. if date type is Int,the _data size is the integer count

	};
}
#endif
